package com.service.impl;

import com.mapper.RoleMapper;
import com.pojo.Role;
import com.service.RoleService;
import com.util.Pager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("roleService")
public class RoleServiceImpl implements RoleService {
    @Resource
    private RoleMapper roleMapper;
    @Override
    public Role searchByRole(String  rid) {
        return roleMapper.searchByRole(rid);
    }

    @Override
    public List<Role> list() {
        return roleMapper.list();
    }

    @Override
    public Pager<Role> searchRolePager(Pager<Role> pager) {
        pager.setRows(roleMapper.searchRolePager(pager));
        int total=roleMapper.total(pager);
        pager.setTotal(total);
        return pager;
    }

    @Override
    public int update(Role role) {
        return roleMapper.update(role);
    }

    @Override
    public int deleteRole(Integer rid) {
        return roleMapper.deleteRole(rid);
    }

    @Override
    public int addRole(Role role) {
        return roleMapper.add(role);
    }
}
